//package com.yfqy.admin.security;
//
//import com.fasterxml.jackson.core.JsonParser;
//import com.fasterxml.jackson.core.type.TypeReference;
//import com.fasterxml.jackson.databind.DeserializationContext;
//import com.fasterxml.jackson.databind.JsonDeserializer;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import org.springframework.security.core.GrantedAuthority;
//import org.springframework.security.core.authority.SimpleGrantedAuthority;
//
//import java.io.IOException;
//import java.util.List;
//import java.util.Map;
//import java.util.stream.Collectors;
//
///**
// * @Author: 梁二东
// * @Date: 2025/5/9 12:36
// * @Description:
// **/
//// 自定义反序列化器
//public class AuthorityDeserializer extends JsonDeserializer<List<GrantedAuthority>> {
//    @Override
//    public List<GrantedAuthority> deserialize(JsonParser p, DeserializationContext ctx) throws IOException {
//        ObjectMapper mapper = (ObjectMapper) p.getCodec();
//        List<Map<String, String>> list = mapper.readValue(p, new TypeReference<List<Map<String, String>>>() {});
//
//        return list.stream()
//                .map(map -> new SimpleGrantedAuthority(map.get("authority")))
//                .collect(Collectors.toList());
//    }
//}
